home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
asmbler.arc
/
BLANK2.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-11-19
|
5KB
|
113 lines
title SCRNSAVE
COMMENT \
Resident program to blank the screen after 5 minutes of no keyboard
activity. Reconstructed from a hex dump of the .COM file given by
Christopher Wiley, in PC World Magazine, April 1984, pp. 236-237
[26-Mar-84] Nelson H.F. Beebe, University of Utah
\
assume cs:SCRNSAVE, ds:SCRNSAVE, es:SCRNSAVE, ss:SCRNSAVE
SCRNSAVE segment para public 'code'
org 100h ; this will be a .COM file
TRUE equ 1
FALSE equ 0
MAXTICKS equ 500 ; why this number for 5 minutes????
USER_INT equ 60h ; 60..67 available, original
; code used IBM reserved value
; 50h
START:
jmp init ;jump around resident code to
;transient code
kbd_active db ?
scr_blanked db ?
KBD_HANDLER: ; here on keyboard interrupt
mov kbd_active,TRUE ; show keyboard in use
int USER_INT ; user interrupt code
iret ; return to interrupt raiser
ticks dw ? ; clock tick counter
current_page db ? ; current active page (overlayed
; ticks+1 in original version)
TIMER_HANDLER: ; here on timer interrupt
pushf ; save flags
push ax ; save ax
cmp kbd_active,TRUE ; keyboard in use?
jne L1 ; no
mov kbd_active,FALSE ; yes, mark it inactive,
call RESTORE_SCREEN ; restore the screen
mov ticks,0000 ; and clear clock tick counter
L1:
cmp scr_blanked,TRUE ; screen blanked already?
je L3 ; yes
inc ticks ; no, increment timer counter
cmp ticks,MAXTICKS ; timer limit reached?
jne L3 ; not yet
call BLANK_SCREEN ; yes, turn off screen to save phosphor
L3:
pop ax ; restore ax
popf ; and flags
iret ; and return to interrupt raiser
BLANK_SCREEN: ; here to blank the screen
push ax ; save ax
mov scr_blanked,TRUE ; mark screen blanked
mov ah,$VIDEO_SETPAGE
mov al,07 ; set to page 7 (normally unused)
int $VIDEO
mov ticks,0000 ; clear clock count
pop ax ; restore ax
ret ; and return to caller
RESTORE_SCREEN: ; here to restore the blanked screen
push ax ; save ax
cmp scr_blanked,TRUE ; already blanked?
je L4 ; yes
mov ah,$VIDEO_GETVIDEOSTATE ; no, find current display page
int $VIDEO
mov current_page,bh ; and save it
L4:
mov scr_blanked,FALSE ; show screen in use
mov ah,$VIDEO_SETPAGE ; and restore the display page
mov al,current_page
int $VIDEO
pop ax ; restore ax
ret ; and return to caller
INIT: ; here when SCRNSAVE invoked
mov ax,0f000h ; BIOS segment
mov ds,ax
; !!!BAD CODE PRACTICE - ABSOLUTE BIOS ADDRESS!!!!
mov dx,0e987h ; address of interrupt handler in ds:dx
; this is BIOS KB_INT routine
mov ah,$DOS_SETINT
mov al,USER_INT ; interrupt type
int $DOS ; restore original BIOS KB_INT handler
mov ax,cs
mov ds,ax ; ds == cs
mov dx,TIMER_HANDLER ; address of interrupt handler in ds:dx
mov ah,$DOS_SETINT ; supply our own handler
mov al,1ch ; interrupt type (timer tick, Tech
int $DOS ; Ref p. 2-4)
mov dx,KBD_HANDLER ; address of interrupt handler in ds:dx
mov ah,$DOS_SETINT
mov al,09h ; interrupt type (keyboard interrupt)
int $DOS ; supply our own handler
mov dx,INIT ; last address + 1
int 27h ; terminate but stay resident
SCRNSAVE ends
end SCRNSAVE